import { actions, S } from "../store"
import { useSelect } from "../redux"


const Add = () => {

    const name = useSelect((state: S) => state.name)
    const age = useSelect((state: S) => state.age)
    const add = () => actions.add(3)
    const addAsync = () => actions.addAsync(100)

    return <div>
        <h1>Add</h1>
        <p>name: {name}</p>
        <p>
            <span>age: </span>
            <button onClick={add} >+</button>
            <span>{age}</span>
            <button onClick={addAsync} >异步加</button>
        </p>
    </div>
}

export default Add